package com.neuedu.web.controller.yunong;

import java.util.List;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neuedu.common.annotation.Log;
import com.neuedu.common.core.controller.BaseController;
import com.neuedu.common.core.domain.AjaxResult;
import com.neuedu.common.enums.BusinessType;
import com.neuedu.yunong.domain.YunongLandAgricultureReport;
import com.neuedu.yunong.service.IYunongLandAgricultureReportService;
import com.neuedu.common.utils.poi.ExcelUtil;
import com.neuedu.common.core.page.TableDataInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 土地资源与农牧细况综合Controller
 *
 * @author ruoyi
 * @date 2024-12-14
 */
@RestController
@RequestMapping("/land/agriculture")
@Tag(name = "【土地资源与农牧细况综合】管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class YunongLandAgricultureReportController extends BaseController
{
    private final IYunongLandAgricultureReportService yunongLandAgricultureReportService;

    /**
     * 查询土地资源与农牧细况综合列表
     */
    @Operation(summary = "查询土地资源与农牧细况综合列表")
    @PreAuthorize("@ss.hasPermi('land:agriculture:list')")
    @GetMapping("/list")
    public TableDataInfo list(YunongLandAgricultureReport yunongLandAgricultureReport)
    {
        startPage();
        List<YunongLandAgricultureReport> list = yunongLandAgricultureReportService.selectYunongLandAgricultureReportList(yunongLandAgricultureReport);
        return getDataTable(list);
    }

    /**
     * 导出土地资源与农牧细况综合列表
     */
    @Operation(summary = "导出土地资源与农牧细况综合列表")
    @PreAuthorize("@ss.hasPermi('land:agriculture:export')")
    @Log(title = "土地资源与农牧细况综合", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YunongLandAgricultureReport yunongLandAgricultureReport)
    {
        List<YunongLandAgricultureReport> list = yunongLandAgricultureReportService.selectYunongLandAgricultureReportList(yunongLandAgricultureReport);
        ExcelUtil<YunongLandAgricultureReport> util = new ExcelUtil<YunongLandAgricultureReport>(YunongLandAgricultureReport.class);
        util.exportExcel(response, list, "土地资源与农牧细况综合数据");
    }

    /**
     * 获取土地资源与农牧细况综合详细信息
     */
    @Operation(summary = "获取土地资源与农牧细况综合详细信息")
    @PreAuthorize("@ss.hasPermi('land:agriculture:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yunongLandAgricultureReportService.selectYunongLandAgricultureReportById(id));
    }

    /**
     * 新增土地资源与农牧细况综合
     */
    @Operation(summary = "新增土地资源与农牧细况综合")
    @PreAuthorize("@ss.hasPermi('land:agriculture:add')")
    @Log(title = "土地资源与农牧细况综合", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YunongLandAgricultureReport yunongLandAgricultureReport)
    {
        return toAjax(yunongLandAgricultureReportService.insertYunongLandAgricultureReport(yunongLandAgricultureReport));
    }

    /**
     * 修改土地资源与农牧细况综合
     */
    @Operation(summary = "修改土地资源与农牧细况综合")
    @PreAuthorize("@ss.hasPermi('land:agriculture:edit')")
    @Log(title = "土地资源与农牧细况综合", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YunongLandAgricultureReport yunongLandAgricultureReport)
    {
        return toAjax(yunongLandAgricultureReportService.updateYunongLandAgricultureReport(yunongLandAgricultureReport));
    }

    /**
     * 删除土地资源与农牧细况综合
     */
    @Operation(summary = "删除土地资源与农牧细况综合")
    @PreAuthorize("@ss.hasPermi('land:agriculture:remove')")
    @Log(title = "土地资源与农牧细况综合", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable( name = "ids" ) Long[] ids)
    {
        return toAjax(yunongLandAgricultureReportService.deleteYunongLandAgricultureReportByIds(ids));
    }
}
